import { request } from '../../../services/request';

// 搜索设备信息接口
export const searchDeviceInfoApi = async (params: {
    keyword?: string;
    state_list?: number[];
    room_id_list?: string[];
    current?: number;
    size?: number;
}) => {
    const requestBody = {
        current: params.current || 1,
        size: params.size || 10,
        room_id_list: params.room_id_list || [],
        state_list: params.state_list || [],
        keyword: params.keyword || '',
    };

    const res = await request('/app/appDeviceInfo/searchDeviceInfo', {
        method: 'POST',
        body: JSON.stringify(requestBody),
    });
    // console.log('searchDeviceInfo接口返回:', res);
    return res;
};

// 获取车间下拉数据接口
export const getAllRoomApi = async () => {
    const res = await request('/app/appCommon/getAllRoom', {
        method: 'POST',
        body: JSON.stringify({}),
    });
    // console.log('getAllRoom接口返回（车间下拉）:', res);
    return res;
};

// 获取设备详情接口
export const getDeviceInfoApi = async (device_id: string) => {
    const res = await request('/app/appDeviceInfo/getDeviceInfo', {
        method: 'POST',
        body: JSON.stringify({ device_id }),
    });
    // console.log('getDeviceInfo接口返回:', res);
    return res;
}; 